/**
 * 客服模块
 */
define(function (require, exports, module) {
    var $ = require('jquery');
    var drag = require('/static_public/node_modules/artdialog/src/drag');
    var bizqq = require('/static_public/js/jquery.BizQQ');

    $(function () {
        $(".close_zixun").click(function () {
            $(".zixun").hide();
        });

        var zixun = document.getElementById('zixun');
        bizqq({aty: '0', a: '0', nameAccount: 4008333870, selector: 'js_BizQQWPA'});
        var dragging = false;
        $("#maskHelp").on('click', function () {
            $('#js_BizQQWPA')[0].click();
        });
        // 拖拽支持
        $(zixun).on(drag.types.start, function (event) {
            event.preventDefault();
            var api = drag.create(zixun, event);
            api.onover = function () {
                if (!dragging) {
                    $("#maskHelp").off('click');
                }
                dragging = true;
            };
            api.onend = function () {
                setTimeout(function () {
                    dragging = false;
                    $("#maskHelp").off('click').on('click', function () {
                        $('#js_BizQQWPA')[0].click();
                    })
                }, 200);
            };
        })
    });
});